rtpengine: add patch fixing compilation error for pthread tid
authorChristian Marangi <[email protected]>
Fri, 21 Nov 2025 14:44:10 +0000 (15:44 +0100)
committerChristian Marangi <[email protected]>
Fri, 21 Nov 2025 14:44:10 +0000 (15:44 +0100)
Add patch fixing compilation error for wrong pthread tid init.

While at it also renumber the patch to to follow the pattern of 1xx for
downstream patch.

Signed-off-by: Christian Marangi <[email protected]>
net/rtpengine/patches/04-prevent-systemd-detection.patch [deleted file]
net/rtpengine/patches/05-use-spandsp3.patch [deleted file]
net/rtpengine/patches/07-always-dynamically-allocate-buffer-for-kernel-mod.patch [deleted file]
net/rtpengine/patches/08-no-docs.patch [deleted file]
net/rtpengine/patches/100-prevent-systemd-detection.patch [new file with mode: 0644]
net/rtpengine/patches/101-use-spandsp3.patch [new file with mode: 0644]
net/rtpengine/patches/102-always-dynamically-allocate-buffer-for-kernel-mod.patch [new file with mode: 0644]
net/rtpengine/patches/103-no-docs.patch [new file with mode: 0644]
net/rtpengine/patches/104-daemon-poller-fix-compilation-error-for-pthread-tid.patch [new file with mode: 0644]

diff --git a/net/rtpengine/patches/04-prevent-systemd-detection.patch b/net/rtpengine/patches/04-prevent-systemd-detection.patch
deleted file mode 100644 (file)
index 33c1727..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
---- a/lib/lib.Makefile
-+++ b/lib/lib.Makefile
-@@ -35,10 +35,10 @@ ifeq ($(RTPENGINE_VERSION),)
- endif
- CFLAGS+=      -DRTPENGINE_VERSION="\"$(RTPENGINE_VERSION)\""
--# look for libsystemd
--ifeq ($(shell pkg-config --exists libsystemd && echo yes),yes)
--have_libsystemd := yes
--endif
-+# No libsystemd in OpenWrt, but pkg-config could find build host's.
-+#ifeq ($(shell pkg-config --exists libsystemd && echo yes),yes)
-+have_libsystemd := no
-+#endif
- ifeq ($(have_libsystemd),yes)
- CFLAGS+=      $(shell pkg-config --cflags libsystemd)
- CFLAGS+=      -DHAVE_LIBSYSTEMD
diff --git a/net/rtpengine/patches/05-use-spandsp3.patch b/net/rtpengine/patches/05-use-spandsp3.patch
deleted file mode 100644 (file)
index 1e75359..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
---- a/daemon/Makefile
-+++ b/daemon/Makefile
-@@ -32,7 +32,7 @@ CFLAGS+=     $(shell pkg-config --cflags lib
- CFLAGS+=      $(shell pkg-config --cflags libavutil)
- CFLAGS+=      $(shell pkg-config --cflags libswresample)
- CFLAGS+=      $(shell pkg-config --cflags libavfilter)
--CFLAGS+=      $(shell pkg-config --cflags spandsp)
-+CFLAGS+=      $(shell pkg-config --cflags spandsp3)
- CFLAGS+=      $(shell pkg-config --cflags opus)
- CFLAGS+=      -DWITH_TRANSCODING
- CFLAGS+=        $(shell mysql_config --cflags)
-@@ -68,7 +68,7 @@ LDLIBS+=     $(shell pkg-config --libs libav
- LDLIBS+=      $(shell pkg-config --libs libavutil)
- LDLIBS+=      $(shell pkg-config --libs libswresample)
- LDLIBS+=      $(shell pkg-config --libs libavfilter)
--LDLIBS+=      $(shell pkg-config --libs spandsp)
-+LDLIBS+=      $(shell pkg-config --libs spandsp3)
- LDLIBS+=      $(shell pkg-config --libs opus)
- LDLIBS+=        $(shell mysql_config --libs)
- endif
diff --git a/net/rtpengine/patches/07-always-dynamically-allocate-buffer-for-kernel-mod.patch b/net/rtpengine/patches/07-always-dynamically-allocate-buffer-for-kernel-mod.patch
deleted file mode 100644 (file)
index 7d67fee..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
---- a/kernel-module/xt_RTPENGINE.c
-+++ b/kernel-module/xt_RTPENGINE.c
-@@ -3786,7 +3786,6 @@ static inline ssize_t proc_control_read_
-       struct rtpengine_table *t;
-       int err;
-       enum rtpengine_command cmd;
--      char scratchbuf[512];
-       size_t readlen, writelen, writeoffset;
-       int i;
-@@ -3828,13 +3827,9 @@ static inline ssize_t proc_control_read_
-               return -ERANGE;
-       // do we need an extra large storage buffer?
--      if (buflen > sizeof(scratchbuf)) {
--              msg.storage = kmalloc(buflen, GFP_KERNEL);
--              if (!msg.storage)
--                      return -ENOMEM;
--      }
--      else
--              msg.storage = scratchbuf;
-+      msg.storage = kmalloc(buflen, GFP_KERNEL);
-+      if (!msg.storage)
-+              return -ENOMEM;
-       // get our table
-       inode = file->f_path.dentry->d_inode;
-@@ -3947,16 +3942,14 @@ static inline ssize_t proc_control_read_
-                       goto err_free;
-       }
--      if (msg.storage != scratchbuf)
--              kfree(msg.storage);
-+      kfree(msg.storage);
-       return buflen;
- err_table_free:
-       table_put(t);
- err_free:
--      if (msg.storage != scratchbuf)
--              kfree(msg.storage);
-+      kfree(msg.storage);
-       return err;
- }
- static ssize_t proc_control_write(struct file *file, const char __user *ubuf, size_t buflen, loff_t *off) {
diff --git a/net/rtpengine/patches/08-no-docs.patch b/net/rtpengine/patches/08-no-docs.patch
deleted file mode 100644 (file)
index b93af2b..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
---- a/lib/common.Makefile
-+++ b/lib/common.Makefile
-@@ -34,12 +34,6 @@ $(DAEMONSRCS) $(HASHSRCS):  $(patsubst %,
-               echo '#line 1' && \
-               cat ../daemon/"$@" ) > "$@"
--%.8: ../docs/%.md
--      cat "$<" | sed '/^# /d; s/^##/#/' | \
--              pandoc -s -t man \
--                      -M "footer:$(RTPENGINE_VERSION)" \
--                      -M "date:$(BUILD_DATE)" \
--                      -o "$@"
- resample.c codeclib.strhash.c mix.c packet.c: fix_frame_channel_layout.h
---- a/daemon/Makefile
-+++ b/daemon/Makefile
-@@ -93,11 +93,8 @@ LIBASM=             mvr2s_x64_avx2.S mvr2s_x64_avx5
- endif
- OBJS=         $(SRCS:.c=.o) $(LIBSRCS:.c=.o) $(LIBASM:.S=.o)
--MDS=          rtpengine.ronn
--MANS=         $(MDS:.ronn=.8)
- include ../lib/common.Makefile
- install: $(TARGET) $(MANS)
-       install -m 0755 -D $(TARGET) $(DESTDIR)/usr/bin/$(TARGET)
--      install -m 0644 -D $(TARGET).8 $(DESTDIR)/usr/share/man/man8/$(TARGET).8
---- a/recording-daemon/Makefile
-+++ b/recording-daemon/Makefile
-@@ -39,11 +39,8 @@ LIBSRCS=    loglib.c auxlib.c rtplib.c code
- LIBASM=               mvr2s_x64_avx2.S mvr2s_x64_avx512.S mix_in_x64_avx2.S mix_in_x64_avx512bw.S mix_in_x64_sse2.S
- OBJS=         $(SRCS:.c=.o) $(LIBSRCS:.c=.o) $(LIBASM:.S=.o)
--MDS=          rtpengine-recording.ronn
--MANS=         $(MDS:.ronn=.8)
- include ../lib/common.Makefile
- install: $(TARGET) $(MANS)
-       install -m 0755 -D $(TARGET) $(DESTDIR)/usr/bin/$(TARGET)
--      install -m 0644 -D $(TARGET).8 $(DESTDIR)/usr/share/man/man8/$(TARGET).8
diff --git a/net/rtpengine/patches/100-prevent-systemd-detection.patch b/net/rtpengine/patches/100-prevent-systemd-detection.patch
new file mode 100644 (file)
index 0000000..33c1727
--- /dev/null
@@ -0,0 +1,17 @@
+--- a/lib/lib.Makefile
++++ b/lib/lib.Makefile
+@@ -35,10 +35,10 @@ ifeq ($(RTPENGINE_VERSION),)
+ endif
+ CFLAGS+=      -DRTPENGINE_VERSION="\"$(RTPENGINE_VERSION)\""
+-# look for libsystemd
+-ifeq ($(shell pkg-config --exists libsystemd && echo yes),yes)
+-have_libsystemd := yes
+-endif
++# No libsystemd in OpenWrt, but pkg-config could find build host's.
++#ifeq ($(shell pkg-config --exists libsystemd && echo yes),yes)
++have_libsystemd := no
++#endif
+ ifeq ($(have_libsystemd),yes)
+ CFLAGS+=      $(shell pkg-config --cflags libsystemd)
+ CFLAGS+=      -DHAVE_LIBSYSTEMD
diff --git a/net/rtpengine/patches/101-use-spandsp3.patch b/net/rtpengine/patches/101-use-spandsp3.patch
new file mode 100644 (file)
index 0000000..1e75359
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/daemon/Makefile
++++ b/daemon/Makefile
+@@ -32,7 +32,7 @@ CFLAGS+=     $(shell pkg-config --cflags lib
+ CFLAGS+=      $(shell pkg-config --cflags libavutil)
+ CFLAGS+=      $(shell pkg-config --cflags libswresample)
+ CFLAGS+=      $(shell pkg-config --cflags libavfilter)
+-CFLAGS+=      $(shell pkg-config --cflags spandsp)
++CFLAGS+=      $(shell pkg-config --cflags spandsp3)
+ CFLAGS+=      $(shell pkg-config --cflags opus)
+ CFLAGS+=      -DWITH_TRANSCODING
+ CFLAGS+=        $(shell mysql_config --cflags)
+@@ -68,7 +68,7 @@ LDLIBS+=     $(shell pkg-config --libs libav
+ LDLIBS+=      $(shell pkg-config --libs libavutil)
+ LDLIBS+=      $(shell pkg-config --libs libswresample)
+ LDLIBS+=      $(shell pkg-config --libs libavfilter)
+-LDLIBS+=      $(shell pkg-config --libs spandsp)
++LDLIBS+=      $(shell pkg-config --libs spandsp3)
+ LDLIBS+=      $(shell pkg-config --libs opus)
+ LDLIBS+=        $(shell mysql_config --libs)
+ endif
diff --git a/net/rtpengine/patches/102-always-dynamically-allocate-buffer-for-kernel-mod.patch b/net/rtpengine/patches/102-always-dynamically-allocate-buffer-for-kernel-mod.patch
new file mode 100644 (file)
index 0000000..7d67fee
--- /dev/null
@@ -0,0 +1,46 @@
+--- a/kernel-module/xt_RTPENGINE.c
++++ b/kernel-module/xt_RTPENGINE.c
+@@ -3786,7 +3786,6 @@ static inline ssize_t proc_control_read_
+       struct rtpengine_table *t;
+       int err;
+       enum rtpengine_command cmd;
+-      char scratchbuf[512];
+       size_t readlen, writelen, writeoffset;
+       int i;
+@@ -3828,13 +3827,9 @@ static inline ssize_t proc_control_read_
+               return -ERANGE;
+       // do we need an extra large storage buffer?
+-      if (buflen > sizeof(scratchbuf)) {
+-              msg.storage = kmalloc(buflen, GFP_KERNEL);
+-              if (!msg.storage)
+-                      return -ENOMEM;
+-      }
+-      else
+-              msg.storage = scratchbuf;
++      msg.storage = kmalloc(buflen, GFP_KERNEL);
++      if (!msg.storage)
++              return -ENOMEM;
+       // get our table
+       inode = file->f_path.dentry->d_inode;
+@@ -3947,16 +3942,14 @@ static inline ssize_t proc_control_read_
+                       goto err_free;
+       }
+-      if (msg.storage != scratchbuf)
+-              kfree(msg.storage);
++      kfree(msg.storage);
+       return buflen;
+ err_table_free:
+       table_put(t);
+ err_free:
+-      if (msg.storage != scratchbuf)
+-              kfree(msg.storage);
++      kfree(msg.storage);
+       return err;
+ }
+ static ssize_t proc_control_write(struct file *file, const char __user *ubuf, size_t buflen, loff_t *off) {
diff --git a/net/rtpengine/patches/103-no-docs.patch b/net/rtpengine/patches/103-no-docs.patch
new file mode 100644 (file)
index 0000000..b93af2b
--- /dev/null
@@ -0,0 +1,43 @@
+--- a/lib/common.Makefile
++++ b/lib/common.Makefile
+@@ -34,12 +34,6 @@ $(DAEMONSRCS) $(HASHSRCS):  $(patsubst %,
+               echo '#line 1' && \
+               cat ../daemon/"$@" ) > "$@"
+-%.8: ../docs/%.md
+-      cat "$<" | sed '/^# /d; s/^##/#/' | \
+-              pandoc -s -t man \
+-                      -M "footer:$(RTPENGINE_VERSION)" \
+-                      -M "date:$(BUILD_DATE)" \
+-                      -o "$@"
+ resample.c codeclib.strhash.c mix.c packet.c: fix_frame_channel_layout.h
+--- a/daemon/Makefile
++++ b/daemon/Makefile
+@@ -93,11 +93,8 @@ LIBASM=             mvr2s_x64_avx2.S mvr2s_x64_avx5
+ endif
+ OBJS=         $(SRCS:.c=.o) $(LIBSRCS:.c=.o) $(LIBASM:.S=.o)
+-MDS=          rtpengine.ronn
+-MANS=         $(MDS:.ronn=.8)
+ include ../lib/common.Makefile
+ install: $(TARGET) $(MANS)
+       install -m 0755 -D $(TARGET) $(DESTDIR)/usr/bin/$(TARGET)
+-      install -m 0644 -D $(TARGET).8 $(DESTDIR)/usr/share/man/man8/$(TARGET).8
+--- a/recording-daemon/Makefile
++++ b/recording-daemon/Makefile
+@@ -39,11 +39,8 @@ LIBSRCS=    loglib.c auxlib.c rtplib.c code
+ LIBASM=               mvr2s_x64_avx2.S mvr2s_x64_avx512.S mix_in_x64_avx2.S mix_in_x64_avx512bw.S mix_in_x64_sse2.S
+ OBJS=         $(SRCS:.c=.o) $(LIBSRCS:.c=.o) $(LIBASM:.S=.o)
+-MDS=          rtpengine-recording.ronn
+-MANS=         $(MDS:.ronn=.8)
+ include ../lib/common.Makefile
+ install: $(TARGET) $(MANS)
+       install -m 0755 -D $(TARGET) $(DESTDIR)/usr/bin/$(TARGET)
+-      install -m 0644 -D $(TARGET).8 $(DESTDIR)/usr/share/man/man8/$(TARGET).8
diff --git a/net/rtpengine/patches/104-daemon-poller-fix-compilation-error-for-pthread-tid.patch b/net/rtpengine/patches/104-daemon-poller-fix-compilation-error-for-pthread-tid.patch
new file mode 100644 (file)
index 0000000..7f1e4e5
--- /dev/null
@@ -0,0 +1,31 @@
+From 77e2cd4b250e806701081a8b262aa0a804423659 Mon Sep 17 00:00:00 2001
+From: Christian Marangi <[email protected]>
+Date: Fri, 21 Nov 2025 15:39:53 +0100
+Subject: [PATCH] daemon: poller: fix compilation error for pthread tid
+
+Fix compilation error for pthread tid wrong init.
+
+poller.c: In function 'poller_map_add':
+poller.c:54:18: error: initialization of 'pthread_t' {aka 'struct __pthread *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
+   54 |
+      |
+
+Setting to -1 is wrong and actually not useful as it gets set right
+after if map is not NULL.
+
+Signed-off-by: Christian Marangi <[email protected]>
+---
+ lib/poller.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/lib/poller.c
++++ b/lib/poller.c
+@@ -51,7 +51,7 @@ struct poller_map *poller_map_new(void)
+ }
+ static void poller_map_add(struct poller_map *map) {
+-      pthread_t tid = -1;
++      pthread_t tid;
+       struct poller *p;
+       if (!map)
+               return;